package org.kazuhiko.pokemon3d.game.hud;

import static org.lwjgl.opengl.GL11.GL_QUADS;
import static org.lwjgl.opengl.GL11.glBegin;
import static org.lwjgl.opengl.GL11.glColor4f;
import static org.lwjgl.opengl.GL11.glEnd;
import static org.lwjgl.opengl.GL11.glTexCoord2f;
import static org.lwjgl.opengl.GL11.glVertex2f;

import org.kazuhiko.pokemon3d.utility.tools.ImagingTools;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;

public class StatsHUD extends HUDItem
{
	private float startX;
	private float startY;

	private float width;
	private float height;
	
	private Texture texture;
	
	public StatsHUD( float startX, float startY, float width, float height )
	{
		this.startX = startX;
		this.startY = startY;
		this.width = width;
		this.height = height;
		
		texture = ImagingTools.loadTexture( "res/textures/hud/stats_hud.png" );
	}
	
	public float getX()
	{
		return startX;
	}
	
	public float getY()
	{
		return startY;
	}
	
	@Override
	public void render()
	{		
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID() );
		
		glBegin( GL_QUADS );
		{
			glColor4f( 1.0f, 1.0f, 1.0f, 0.5f );
			
			glTexCoord2f( 0f, 0f );
			glVertex2f( startX, startY );
			
			glTexCoord2f( texture.getWidth(), 0f );
			glVertex2f( startX + width, startY );
			
			glTexCoord2f( texture.getWidth(), texture.getHeight() );
			glVertex2f( startX + width, startY + height );
			
			
			glTexCoord2f( 0, texture.getHeight() );
			glVertex2f( startX, startY + height );
		}
		glEnd();
		
		/*
		Pokemon player = ( Pokemon ) Pokemon3D.getWorld().getCamera().getFollowObject();
		TextRenderer.getRenderer().render2DText( player.getPokedexId() + "", org.newdawn.slick.Color.black, getX() + 110f, getY() + 17f );
		TextRenderer.getRenderer().render2DText( player.getName(), org.newdawn.slick.Color.black, getX() + 110f, getY() + 39f );
		TextRenderer.getRenderer().render2DText( player.getTypes().get( 0 ).name(), org.newdawn.slick.Color.black, getX() + 110f, getY() + 60f );
		TextRenderer.getRenderer().render2DText( "N.V.T", org.newdawn.slick.Color.black, getX() + 110f, getY() + 83f );
		TextRenderer.getRenderer().render2DText( "Kazuhiko", org.newdawn.slick.Color.black, getX() + 110f, getY() + 104f );
		TextRenderer.getRenderer().render2DText( player.getHP() + "", org.newdawn.slick.Color.black, getX() + 110f, getY() + 127f );
		TextRenderer.getRenderer().render2DText( player.getXP() + "", org.newdawn.slick.Color.black, getX() + 110f, getY() + 149f );
		*/
	}
}